package com.gao.handle;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class Student2 {
    private String name;
    private int age;
    private int english;
    private int chinese;
    private int math;


    public Student2() {
    }

    public Student2(String name, int age, int english, int chinese, int math) {
        this.name = name;
        this.age = age;
        this.english = english;
        this.chinese = chinese;
        this.math = math;
    }

    /**
     * 获取
     *
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     *
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     *
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     *
     * @param age
     */
    public void setAge(int age) throws Exception {
        if (age > 0 && age <= 120) {
            this.age = age;
        } else {
            throw new Exception("年龄不在0~120之间");
        }

    }

    /**
     * 获取
     *
     * @return english
     */
    public int getEnglish() {
        return english;
    }

    /**
     * 设置
     *
     * @param english
     */
    public void setEnglish(int english) throws Exception {
        if (english >= 0 && english <= 100) {
            this.english = english;
        } else {
            throw new Exception("分数不在0~100之间");
        }
    }

    /**
     * 获取
     *
     * @return chinese
     */
    public int getChinese() {
        return chinese;
    }

    /**
     * 设置
     *
     * @param chinese
     */
    public void setChinese(int chinese) throws Exception {
        if (chinese >= 0 && chinese <= 100){
            this.chinese = chinese;
        }else{
            throw new Exception("分数不在0~100之间");
        }

    }

    /**
     * 获取
     *
     * @return math
     */
    public int getMath() {
        return math;
    }

    /**
     * 设置
     *
     * @param math
     */
    public void setMath(int math) throws Exception {
        if(math>=0&&math<=100){
            this.math = math;
        }else{
            throw new Exception("分数不在0~100之间");
        }


    }

    public String toString() {
        return "Student2{name = " + name + ", age = " + age + ", english = " + english + ", chinese = " + chinese + ", math = " + math + "}";
    }
}
